package com.ctgu.蓝桥杯真题.B组2014;

/**
 * @author: Backdiy
 * @data: 2021/4/15 20:51
 * @desc:
 */
public class 奇怪的分式6 {
    static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    public static void main(String[] args) {
        int ans = 0;
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j < 10; j++) {
                if (i == j) continue;
                for (int k = 1; k < 10; k++) {
                    for (int l = 1; l < 10; l++) {
                        if (k == l) continue;
                        int a = i*k;
                        int b = i*10+k;
                        int c = j*l;
                        int d = j*10+l;
                        int g1 = gcd(a, c);
                        int g2 = gcd(b, d);
                        if (a/g1 == b/g2 && c/g1==d/g2) ans++;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}
